define([], function() {
	return function() {
		let html = null;
		let loadHtml = function(fn = () => {}) {
			$.get(
				"logout.html",
				function(data) {
					html = $(data).appendTo("body");
					html.find("._confirm").click(function() {
						$.post(
							"user/logout.do",
							function(data) {
								window.location = "./";
							}, "json"
						);
						return false;
					});
					fn();
				}, "html"
			);
		}

		let logout = () => {
			html.modal("show");
		}
		$(document.body).on("click", "[data-logout]", () => {
			if(html == null) {
				loadHtml(() => {
					logout();
				});
			} else {
				logout();
			}
		}).on("click","[data-shops]",function(){
			console.info($(this));
			let id = $(this).data("shops");
			require(["manage/shops/info"],function(temp){
				temp(id);
			});
			return false;
		}).on("click","[data-user]",function(){
			let id = $(this).data("user");
			require(["manage/user/info"],function(temp){
				temp(id);
			});
			return false;
		});

	}
});